package com.firebird.app.kotlin.stock.ui.godeal.tab.tab_haved

import android.R
import android.annotation.SuppressLint
//import androidx..widget.Rec
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.View
import butterknife.BindView
import butterknife.Unbinder
import com.firebird.app.kotlin.stock.base.BaseMvpFragment
import com.firebird.app.kotlin.stock.data.DetailsDealBean.PositionsBean
import com.firebird.app.kotlin.stock.myview.state_layout.OtherView
import com.firebird.app.kotlin.stock.ui.godeal.tab.tab_haved.contract.TabHavedContract
import com.firebird.app.kotlin.stock.ui.godeal.tab.tab_haved.presenter.TabHavedPresenter


@SuppressLint("ValidFragment")
class TabHaved(private val list: List<PositionsBean?>) : BaseMvpFragment<TabHavedPresenter?>(), TabHavedContract.View {
    @BindView(R.id.recycler)
    var recycler: RecyclerView? = null
    @BindView(R.id.otherview)
    var otherview: OtherView? = null
    var unbinder: Unbinder? = null
    private var adp: Adp? = null
    override fun initView(view: View?) {
        otherview!!.setHolder(mHolder)
        if (list.size == 0) {
            otherview!!.showEmptyView()
        } else {
            otherview!!.showContentView()
            recycler.setLayoutManager(LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false))
            recycler.setNestedScrollingEnabled(false)
            adp = Adp(R.layout.item_haved, list)
            recycler.setAdapter(adp)
            adp!!.openLoadAnimation()
        }
    }

    override val layoutId: Int
        protected get() = R.layout.tab_haved

    override fun showLoading() {}
    override fun hideLoading() {}
    override fun onError(throwable: Throwable?) {}

}